<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>皇室蛋糕</title>
<link rel="shortcut icon" type="image/x-icon" href="resource/bifavi.ico" rel="external nofollow" /> 
<link rel="stylesheet" type="text/css" href="res/static/css/main.css">
<link rel="stylesheet" type="text/css" href="res/layui/css/layui.css">
<script type="text/javascript" src="res/layui/layui.js"></script>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
</head>
<body>

	<div class="site-nav-bg">
		<div class="site-nav w1200">
			<p class="sn-back-home">
				<i class="layui-icon layui-icon-home"></i> <a href="index.jsp">首页</a>
			</p>
			<div class="sn-quick-menu">
				<div class="login">
					<c:if test="${CURR_COM == null }">
						<a href="goConsumerLogin">登录</a>
					</c:if>
					<c:if test="${CURR_COM != null }">
						<a href="gopersoninfo"><c:out value="${CURR_COM}" /></a>  &nbsp; &nbsp; &nbsp;
						<a href="zhuxiao">注销</a>
					</c:if>
				</div>
				<div class="sp-cart">
					<a href="goshopcar">购物车</a><span><c:if
							test="${CURR_NUM == null }"></c:if> <c:if
							test="${CURR_NUM != null }">
							<c:out value="${CURR_NUM}" />
						</c:if></span>
				</div>
			</div>
		</div>
	</div>



	<div class="header">
		<div class="headerLayout w1200">
			<div class="headerCon">
				<h1 class="mallLogo">
					<a href="index.jsp" title="皇室蛋糕"> <img
						src="images/img/logo1.png">
					</a>
				</h1>
				<div class="mallSearch">
					<form action="goSearchJsp" class="layui-form" novalidate>
						<input type="text" name="title" required lay-verify="required"
							autocomplete="off" class="layui-input" placeholder="请输入需要的商品">
						<button class="layui-btn" lay-submit lay-filter="formDemo">
							<i class="layui-icon layui-icon-search"></i>
						</button>
						<input type="hidden" name="" value="">
					</form>
				</div>
			</div>
		</div>
	</div>


	<div class="content content-nav-base  login-content">
		<div class="main-nav">
			<div class="inner-cont0">
				<div class="inner-cont1 w1200">
					<div class="inner-cont2">
							<a href="commodity.html" class="active">所有商品</a> <a href="gotusi">吐司和礼品</a>
						<a href="information.html">烘焙故事</a> <a href="aboutUs">关于我们</a>
					</div>
				</div>
			</div>
		</div>
		<div class="login-bg">
			<div class="login-cont w1200">
				<div class="form-box">
					<!--   <form class="layui-form" action="#" method="get"> -->
					<legend>登录</legend>
					<div class="layui-form-item">
						<div class="layui-inline iphone">
							<div class="layui-input-inline">
								<i class="layui-icon layui-icon-cellphone iphone-icon"></i> <input
									type="text" name="phonename" id="phonename"
									placeholder="请输入用户名" class="layui-input">
							</div>
						</div>
						<div class="layui-inline iphone">
							<div class="layui-input-inline">
								<i class="layui-icon layui-icon-cellphone iphone-icon"></i> <input
									type="password" name="pwdcom" id="pwdcom" placeholder="请输入密码"
									class="layui-input">
							</div>
						</div>
						<p id="error_COM">${error_COM }</p>  
					</div>
					<input type="hidden" name="urltest" value="${urltest }"
						id="urltest"> <input type="hidden" name="title"
						value="${title }" id="title"> <input type="hidden"
						name="buyNum" value="${buyNum }" id="buyNum">
					<div class="layui-form-item login-btn">
						<div class="layui-input-block">
							<button class="layui-btn" id="btnsubmit">登录</button>
							<!--  <input class="layui-btn" type="submit" value="登录" id="btnsubmit"> -->
						</div>
						<div class="layui-input-block">
							<a class="layui-btn" id="btnsubmit" href="register.jsp"> 用户注册</a>
							<a class="layui-btn" id="btnsubmit" href="goadminlogin"> 管理员登录登录</a>
							<!--  <input class="layui-btn" type="submit" value="登录" id="btnsubmit"> -->
						</div>
					</div>
					<!--   </form> -->
				</div>
			</div>
		</div>
	</div>

	  <!-- 底部 -->
  <div class="footer">
    <div class="ng-promise-box">
      <div class="ng-promise w1200">
        <p class="text">
          <a class="icon1" href="javascript:;">7天无理由退换货</a>
          <a class="icon2" href="javascript:;">满99元全场免邮</a>
          <a class="icon3" style="margin-right: 0" href="javascript:;">100%品质保证</a>
        </p>
      </div>
    </div>
    <div class="mod_help w1200">                                     
      <p>
        <a href="aboutUs">关于我们</a>
        <span>|</span>
        <a href="helpCenter">帮助中心</a>
        <span>|</span>
        <a href="afterService">售后服务</a>
        <span>|</span>
        <a href="javascript:;">客服资讯</a>
        <span>|</span>
        <a href="javascript:;">关于货源</a>
      </p>
      <p class="coty">皇室蛋糕版权所有 &copy; 2018-2020</p>
    </div>
  </div>

	<script type="text/javascript">
		//console.log("buyNum:" + $("#buyNum").val());
		//console.log("title:" + $("#title").val());
		//console.log("urltest:" + $("#urltest").val());
		var urldemo=window.location.href;
		console.log(urldemo+"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@")
		$(function() {
			$("#pwdcom").keyup(function(){
				$("#error_COM").html("");
			})
			
			$("#btnsubmit").click(
					function() {
						var phone = $("#phonename").val();
						var pwd = $("#pwdcom").val();
						console.log("222222222测试222222222" + phone);
						console.log("2222222222测试22222222" + pwd);
						var buyNum = $("#buyNum").val();
						var title = $("#title").val();
						var urltest = $("#urltest").val();
						//console.log($("#buyNum").val());
						//console.log($("#title").val());
						//console.log($("#urltest").val());
						///alert(phone);
						$.ajax({
							type : "get",
							url : "comlogin",
							dataType : "json",//返回的
							data : "phonename=" + phone + "&pwdcom=" + pwd
									+ "&buyNum=" + buyNum + "&title=" + title
									+ "&urltest=" + urltest,
							// data:"phonename="+phone+"&pwdcom="+pwd +"&urltest="+urltest,
							success : function(data) {
								//alert(data);
								var urldemo=window.location.href;
								console.log(urldemo+"测试data:----"+data);
								console.log("测试data:----"+data.urldemo);
								
								 if (data.status == 1) {

									// 用户登录成功
									window.location.href=data.urldemo;
								}else if(data.status == 2){
									//用户 登录失败
									var error_COMdemo=data.error_COM;
									$("#error_COM").html(error_COMdemo);
									console.log("测试error_COM:----"+error_COMdemo);
								}else if(data.status == 3){
									//用户
									window.location.href=data.success;

								} 

								

								
							}
						});

					})

		})
	</script>
</body>
</html>